package com.tz.farmer.util;

import com.smartPark.msframe.result.ResultEx;
import com.tz.farmer.enums.ErrorCodeEnum;

/**
 * @ClassName ResultExM
 * @Description TODO
 * @Creator ling
 * @Date 2021/3/19 2:32 下午
 */
public class ResultExM<T> extends ResultEx<T> {
    public ResultEx<T> makeResult(ErrorCodeEnum retCode) {
        return this.makeResult(retCode.getCode(), retCode.getMessage(), null);
    }
    public ResultEx<T> makeResult(ErrorCodeEnum retCode, T data) {
        return this.makeResult(retCode.getCode(), retCode.getMessage(), data);
    }

    /**
     * 成功快速返回
     * @return
     */
    public ResultEx<T> makeResultSuccess(){
        return this.makeResult(ErrorCodeEnum.ERR_COMMON_SUCCEED);
    }

    /**
     * 暂无数据返回
     * @return
     */
    public ResultEx<T> makeResultNoData(){
        return this.makeResult(ErrorCodeEnum.ERR_COMMON_NO_DATA);
    }
    public static ResultExM builder() {
        ResultExM resultExM = new ResultExM();
        return resultExM;
    }
}
